package com.api.gbhg.dq.action;


import com.api.gbhg.dq.dao.BudgetAccountDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;


/**
 * 描述: 通用项目下发插入预算科目表单<br/>
 * 作者: qi.dai<br/>
 * 时间: 2021/1/11 13:50 <br/>
 * 更新:
 */
public class BudgetAccountAction implements Action {
    private static final Logger log = LoggerFactory.getLogger(BudgetAccountAction.class);

    @Override
    public String execute(RequestInfo requestInfo) {
        log.info("-----------------通用项目新增表------------------------");
        //流程Id
        String requestid = requestInfo.getRequestid();
        //流程表名
        String billTableName = requestInfo.getRequestManager().getBillTableName();
        RecordSet rs = new RecordSet();
        rs.executeQuery("select * from " + billTableName + " where requestid = " + requestid);
        while (rs.next()) {
            String bsid = rs.getString("bsid");
            if (StringUtil.isNotNull(bsid)) {
                BudgetAccountDao budgetAccountDao = new BudgetAccountDao();
                budgetAccountDao.updateYskxmxfs(bsid, requestid);
            }
        }
        return SUCCESS;
    }
}
